<template>
	<view>
		<backheader :title="title" :closecardflag="closecardflag" :checkflag="checkflag"></backheader>
		<view class="mainMenu">
			<view class="mmitem" :class="{mmactive: mmactiveflag === 1}" @click="changeMm(1)">基本信息</view>
			<view class="mmitem" :class="{mmactive: mmactiveflag === 2}" @click="changeMm(2)">安全措施</view>
			<view class="mmitem" :class="{mmactive: mmactiveflag === 3}" @click="changeMm(3)">危险点预控</view>
			<view class="mmitem" :class="{mmactive: mmactiveflag === 4}" @click="changeMm(4)">沟通汇报</view>
		</view>
		<view class="content">
			<block v-if="mmactiveflag == 1">
				<!-- <wkcondationflu></wkcondationflu> -->
				<wkcondation  :wtId="wtId" :type="type" ref='wkcon'></wkcondation>
	
			</block>
			<block v-if="mmactiveflag == 2">
				<salfIssue  :wtId="wtId"></salfIssue>
			</block>
			<block v-if="mmactiveflag == 3">
				<dangerous  :wtId="wtId"></dangerous>
			</block>
			<block v-if="mmactiveflag == 4">
				<!-- <commuReport></commuReport> -->
				<commuReport2   :wtId="wtId"></commuReport2>
			</block>
		</view>
	</view>
</template>

<script>
	import backheader from "@/components/backHeader/backHeader.vue";
	import wkcondationflu from "./wkcontaionflu.vue"
	import wkcondation from "./wkcondation.vue"
	import salfIssue from "./salfIssue.vue"
	import dangerous from "./dangerous.vue"
	import commuReport from "./commuReport.vue"
	import commuReport2 from "./commuReport2.vue"
	 
	// import { getWttypeDetail } from '@/api/basic.js'
	// import { getWtstdWorkticketDetail } from '@/api/basic.js'
	// import { getWorkticketDetail } from '@/api/basic.js'
	// import { getSafemeasure } from '@/api/basic.js'
	// import { getWtHazardControl } from '@/api/basic.js'
	

	export default {
		data() {
			return {
				closecardflag:true,
				title:"工作票信息",
				checkflag:false,
				mmactiveflag:3,
				wtId:'',
				type: '',
				// stdworkId:1,
				// wtStdWorkticket:{assetNo:"aaaa"},    //标准工作票主票
				// wtworkId:1,
				// wtWorkticket:{},  //工作票主票
				// pageSize:10,
				// currentpage:1,
				// salfIssues:[{smTypeName:"应拉断路器(开关)和隔离开关(刀闸),包括填写前已拉断路器(开关)和隔离开关"}],    // 工作票安全措施类型
				// total:0,
				// pageNumber:0,
				// hazardControls:[{hazard:"高空升降车未检验",controlMeasure:"经(或检验检测监督机构)检验检测合格"},
				// 		{hazard:"液压系统渗漏",controlMeasure:"由操作员工检查升降车完好、液压系统无泄漏"},
				// 		{hazard:"液压系统渗漏",controlMeasure:"由操作员工检查升降车完好、液压系统无泄漏"}],  //危险点预控
				// objId:0,            // 对象ID
				// objNo:"",						//对象类型 操作票：OT，工作票：WT
			}
		},
		components:{
			backheader,
			wkcondation,
			wkcondationflu,
			salfIssue,
			dangerous,
			commuReport,
			commuReport2
		},
		onLoad(option){
			this.wtId = option.id
			this.type = option.type
			this.changeMm(1)
		},
		methods: {
			cpnClick(item){
				console.log(item)
			},
			changeMm(index){
				let that = this
				console.log(index)
				if(index==1){
					
					this.mmactiveflag = 1
					// getWtstdWorkticketDetail(that.stdworkId).then(res=>{  // 请求标准工作篇
					// 	if(res.code == 200){
					// 		that.wtStdWorkticket = res.result
					// 	}
					// })
					// getWorkticketDetail(that.wtworkId).then(res=>{
					// 	if(res.code == 200){
					// 		that.wtWorkticket = res.result
					// 	}
					// })
				}else if(index == 2){
					this.mmactiveflag = 2
					// getSafemeasure(that.currentpage,that.pageSize).then(res=>{
					// 	if(res.code == 200){
					// 		that.salfIssues = res.result.records
					// 		that.total =  res.result.total
					// 		that.pageNumber = res.result.pages
					// 	}
					// })
				}else if(index == 3){
					this.mmactiveflag = 3
					// getWtHazardControl(that.objId,that.objNo,that.currentpage,that.pageSize).then(res=>{
					// 	if(res.code == 200){
					// 		that.hazardControls = res.result.records
					// 		that.total =  res.result.total
					// 		that.pageNumber = res.result.pages
					// 	}
					// })
				}else{
					this.mmactiveflag = 4
				}
			},
			// init(stdworkId) {
			// 	let that = this
			// 	getWorkticketDetail(that.wtworkId).then(res=>{
			// 		if(res.code == 200){
			// 			that.wtWorkticket = res.result
			// 		}
			// 	})				
			// }
		}
	}
</script>
	
<style>
	page{
		background-color: #f9f9f9;
	}
	.mainMenu{
		background-color: #E6E6E6;
		height: 88upx;
		line-height: 88upx;
		text-align: center;
		display: flex;
	}
	.mmitem{
		flex: 1;
		text-align: center;
		font-size: 28upx;
		color: #333333;
	}
	.condation{
		background-color: #ffffff;
		margin-top: 16upx;
		border-radius: 8upx;
	}
	.conmenus{
		display: flex;flex-direction: row;
		padding-top:32upx;
		padding-bottom:32upx;
		border-bottom: solid 1upx #e6e6e6;
	}
	.conmenus:last-child{
		border: 0;
	}
	.conleft{
		width: 40%;
		padding-left: 24upx;
		color: #333333;
		font-size: 28upx;
	}
	.conright{
	//	border: solid 1upx #07C160;
		text-align: right;
		width: 60%;
		direction: right;
		padding-right: 24upx;
		color: #666666;
		font-size: 28upx;
	}
	.mmactive{
		border-bottom: solid 4upx #1E91E6;
	}
	.content{
		padding: 0upx;
		background-color: #F1F1F1;
		
	}
	.salfTitle{
		display: flex;
	}
	.salfContent{
		display: flex;
		flex-direction: column;
		background-color: #FFFFFF;
		border-radius: 8upx;
		margin-top: 24upx;
		margin-bottom: 24upx;
	}
	.salfContentso{
		padding-top: 24upx;padding-bottom: 26upx;width: 80upx;text-align: center;
				color:#666666;border-right: #e7e7e7 solid 1upx;
	}
</style>
